import "@/plugin/global";
import Vue from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";
import localStore from "@/libs/util.store";
import EventBus from "@/libs/util.event";

// 加载插件
import "@/plugin/component";
import "@/plugin/vuescroll";
import "@/plugin/popups";
import "@/plugin/vant";

import AppBar from "@/components/AppBar";
import "@iconfu/svg-inject";

// vue 配置设置
Vue.config.productionTip = false;
Vue.prototype.isDev = process.env.NODE_ENV === "development";
Vue.prototype.event = new EventBus();

window.vivoURL =
  "vivogame://game.vivo.com/openjump?j_type=1&pkgName=com.community.ganke";
Vue.prototype.vivoURL = window.vivoURL;

Vue.component("AppBar", AppBar);

// 初始化
Vue.prototype.initialize = function () {
  // 初始化加载数据
  store.dispatch("data/load");
  localStore.delItem("filter");
};

// 加载分享工具
window.gankeTool = new window.GankeTool();
Vue.prototype.$GankeTool = window.gankeTool;

new Vue({
  router,
  store,
  render: (h) => h(App),
  created() {
    this.initialize();
  },
}).$mount("#app");
